package com.leoman.floatwin.dao;

import com.leoman.common.dao.IBaseJpaRepository;
import com.leoman.floatwin.entity.FloatWin;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by Administrator on 2016/6/12.
 */
public interface FloatWinDao extends IBaseJpaRepository<FloatWin> {

    @Query("select a from FloatWin a")
    FloatWin findOneInfo();

    @Query("select a from FloatWin a where a.position = ?1 and a.detailId = ?2")
    List<FloatWin> findByTypeAndWorkId(Integer type, Long workId);

    @Query("select a from FloatWin a where a.position = ?1 and a.categoryId = ?2")
    List<FloatWin> findByTypeAndCategoryId(Integer type, Long categoryId);

    @Query("select a from FloatWin a where a.position = ?1 and a.categoryId = ?2 and a.detailId = ?3")
    List<FloatWin> findMusicAndGame(Integer type, Long categoryId, Long workId);
}
